Class BaseHandler

Summary

Fully Qualified Name: CodeIgniter\Images\Handlers\BaseHandler
Implements: ImageHandlerInterface

Description

Base image handling implementation

Methods

Name Description Defined By
__call() Provide access to the Image class' methods if they don't exist on the handler itself. BaseHandler
__construct() Constructor. BaseHandler
convert() Changes the stored image type to indicate the new file format to use when saving. BaseHandler
crop() Crops the image to the desired height and width. If one of the height/width values is not provided, that value will be set the appropriate value based on offsets and image dimensions. BaseHandler
fit() Combine cropping and resizing into a single command. BaseHandler
flatten() Flattens transparencies, default white background BaseHandler
flip() Flips an image either horizontally or vertically. BaseHandler
getEXIF() Retrieve the EXIF information from the image, if possible. Returns an array of the information, or null if nothing can be found. BaseHandler
getFile() Returns the image instance. BaseHandler
getHeight() Return image height. BaseHandler
getResource() Returns the temporary image used during the image processing. BaseHandler
getVersion() Get the version of the image library in use. BaseHandler
getWidth() Return image width. BaseHandler
reorient() Reads the EXIF information from the image and modifies the orientation so that displays correctly in the browser. This is especially an issue with images taken by smartphones who always store the image up-right, but set the orientation flag to display it correctly. BaseHandler
resize() Resize the image BaseHandler
rotate() Rotates the image on the current canvas. BaseHandler
save() Saves any changes that have been made to file. BaseHandler
text() Overlays a string of text over the image. BaseHandler
withFile() Sets another image for this handler to work on. BaseHandler

Method Details

__call()

Provide access to the Image class' methods if they don't exist on the handler itself.

Parameter Name Type Description
$name string
$args array

Returns: mixed

__construct()

Constructor.

Parameter Name Type Description
$config \type

Returns:

convert()

Changes the stored image type to indicate the new file format to use when saving.

Does not touch the actual resource.

Parameter Name Type Description
$imageType int|null A

Returns: $this

crop()

Crops the image to the desired height and width. If one of the height/width values is not provided, that value will be set the appropriate value based on offsets and image dimensions.

Parameter Name Type Description
$width int|null
$height int|null
$x int|null X-axis
$y int|null Y-axis
$maintainRatio bool
$masterDim string

Returns: mixed

fit()

Combine cropping and resizing into a single command.

Supported positions:

Parameter Name Type Description
$width int
$height int
$position string

Returns: bool

flatten()

Flattens transparencies, default white background

Parameter Name Type Description
$red int
$green int
$blue int

Returns: mixed

flip()

Flips an image either horizontally or vertically.

Parameter Name Type Description
$dir string Either

Returns: $this

getEXIF()

Retrieve the EXIF information from the image, if possible. Returns an array of the information, or null if nothing can be found.

EXIF data is only supported fr JPEG & TIFF formats.

Parameter Name Type Description
$key string|null If
$silent bool If

Returns: mixed

getFile()

Returns the image instance.

Returns: \CodeIgniter\Images\Image

getHeight()

Return image height.

accessor for testing; not part of interface

Returns: \type

getResource()

Returns the temporary image used during the image processing.

Good for extending the system or doing things this library is not intended to do.

Returns: resource

getVersion()

Get the version of the image library in use.

Returns: string

getWidth()

Return image width.

accessor for testing; not part of interface

Returns: int

reorient()

Reads the EXIF information from the image and modifies the orientation so that displays correctly in the browser. This is especially an issue with images taken by smartphones who always store the image up-right, but set the orientation flag to display it correctly.

Parameter Name Type Description
$silent bool If

Returns: $this

resize()

Resize the image

Parameter Name Type Description
$width int
$height int
$maintainRatio bool If
$masterDim string

Returns: \BaseHandler

rotate()

Rotates the image on the current canvas.

Parameter Name Type Description
$angle float

Returns: mixed

save()

Saves any changes that have been made to file.

Example: $image->resize(100, 200, true)

  ->save($target);
Parameter Name Type Description
$target string
$quality int

Returns: mixed

text()

Overlays a string of text over the image.

Valid options:

Parameter Name Type Description
$text string
$options array

Returns: $this

withFile()

Sets another image for this handler to work on.

Keeps us from needing to continually instantiate the handler.

Parameter Name Type Description
$path string

Returns: $this

Top